﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
 
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace Demo
{
    public partial class MoveRowCol : DemoBaseUserControl
    {
        public MoveRowCol()
        {
            InitializeComponent();
            this.Title = "移动多行或多列";
            this.Description = "Spread .NET  提供移动行或列功能，也可以同时移动多行或多列。要移动行或列，只需点击行头或者列头，然后拖动到目标区域并释放鼠标。要移动多行或多列，先通过鼠标拖动选择多行或多列，然后点击选中区任意行头或列头，拖动到目标区域并释放鼠标。";
        }

        private void MoveRowCol_Load(object sender, EventArgs e)
        {
            FpSpread1.DataSource = 销售明细表TableAdapter.GetData();
            ckRowMove.Checked = true;
            ckColMove.Checked = true;
            ckAllowMultiColumnMove.Checked = true;
            ckAllowMultiRowMov.Checked = true;
            FpSpread1.AllowRowMove = true;
            FpSpread1.AllowRowMoveMultiple = true;
            FpSpread1.AllowColumnMove = true;
            FpSpread1.AllowColumnMoveMultiple = true;
        }

        private void ckRowMove_CheckedChanged(object sender, EventArgs e)
        {
            if (ckRowMove.Checked)
            {
                // Allow
                FpSpread1.AllowRowMove = true;
            }
            else
            {
                // Prevent
                FpSpread1.AllowRowMove = false;
            }
        }

        private void ckAllowMultiRowMov_CheckedChanged(object sender, EventArgs e)
        {
            if (ckAllowMultiRowMov.Checked)
            {
                // Allow
                FpSpread1.AllowRowMoveMultiple = true;
            }
            else
            {
                // Prevent
                FpSpread1.AllowRowMoveMultiple = false;
            }
        }

        private void ckColMove_CheckedChanged(object sender, EventArgs e)
        {
            if (ckColMove.Checked)
            {
                // Allow
                FpSpread1.AllowColumnMove = true;
            }
            else
            {
                // Prevent
                FpSpread1.AllowColumnMove = false;
            }
        }

        private void ckAllowMultiColumnMove_CheckedChanged(object sender, EventArgs e)
        {
            if (ckAllowMultiColumnMove.Checked)
            {
                // Allow
                FpSpread1.AllowColumnMoveMultiple = true;
            }
            else
            {
                // Prevent
                FpSpread1.AllowColumnMoveMultiple = false;
            }
        }

        private void FpSpread1_ColumnDragMove(object sender, FarPoint.Win.Spread.DragMoveEventArgs e)
        {
            e.MoveContent = false;
        }
    }
}
